import ctypes as ct
import libpcap as pcap

# https://www.cnblogs.com/MikeZhang/p/pythonUseLibpcap20221029.html
errbuf = ct.create_string_buffer(pcap.PCAP_ERRBUF_SIZE + 1)
device = pcap.lookupdev(errbuf)
print(errbuf.value)


import ctypes as ct
import libpcap as pcap
errbuf = ct.create_string_buffer(pcap.PCAP_ERRBUF_SIZE + 1)
alldevs = ct.POINTER(pcap.pcap_if_t)()
pcap.findalldevs(ct.byref(alldevs), errbuf)
print(alldevs[0].name)
pcap.freealldevs(alldevs)